import { NativeModules, NativeEventEmitter } from 'react-native';
const { AMapGeolocation } = NativeModules;
const eventEmitter = new NativeEventEmitter(AMapGeolocation);

export default {
  init: () => AMapGeolocation.initAMap(),
  createFence: () => AMapGeolocation.createFence(),
  removeFence: () => AMapGeolocation.removeFence(),
  setOptions: options => AMapGeolocation.setOptions(options),
  start: () => AMapGeolocation.start(),
  stop: () => AMapGeolocation.stop(),
  getLastLocation: () => AMapGeolocation.getLastLocation(),
  addLocationListener: listener =>
    eventEmitter.addListener('AMapGeolocation', listener)
};
